<?php
declare (strict_types = 1);

namespace app\controller\frontend;

use app\model\Category;

class ListController extends BaseController
{

    /**
     * @param Category $Category
     * @return mixed
     * @throws \app\exception\ModelEmptyException
     * @throws \app\exception\ModelException
     */
    public function index(Category $Category)
    {
        $id = (int)input('id');
        $with=['thumbnail'=>function($q){
                $q->field('id,name,url,type');
            },'banner'=>function($q){
                $q->field('id,name,url,type');
            }
        ];
        $category = $Category->getCategory(['id' => $id, 'seller_id' => $this->sellerId, 'website_id' => $this->siteId],$with)['data']->toArray();
        $this->assign('current_cate',$category);
        $template = $category['list_tpl'];
        return $this->fetch($template);
    }

}
